package com.cmict.data.bpm.dal.mysql.task;

import com.cmict.data.framework.common.pojo.PageResult;
import com.cmict.data.framework.mybatis.core.mapper.BaseMapperX;
import com.cmict.data.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.cmict.data.bpm.controller.admin.definition.vo.task.TaskVariablePageReqVO;
import com.cmict.data.bpm.dal.dataobject.task.TaskCarbonDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 流程用户消息 Mapper
 *
 * @author liutao
 */
@Mapper
public interface TaskCarbonMapper extends BaseMapperX<TaskCarbonDO> {


    default PageResult<TaskCarbonDO> selectPage(TaskVariablePageReqVO pageReqVO) {
        return selectPage(pageReqVO, new LambdaQueryWrapperX<TaskCarbonDO>()
                .eqIfPresent(TaskCarbonDO::getProcessDefinitionId, pageReqVO.getProcessDefinitionId())
                .likeIfPresent(TaskCarbonDO::getTaskId, pageReqVO.getTaskId())
                .likeIfPresent(TaskCarbonDO::getTaskName, pageReqVO.getName())
                .eqIfPresent(TaskCarbonDO::getStatus, pageReqVO.getStatus())
                .eqIfPresent(TaskCarbonDO::getUserId, pageReqVO.getUserId())
                .betweenIfPresent(TaskCarbonDO::getCreateTime, pageReqVO.getBeginCreateTime(), pageReqVO.getEndCreateTime())
                .orderByDesc(TaskCarbonDO::getId));
    }
}
